package com.ruoyi.factory.shenxinfu.controller;


import com.ruoyi.factory.shenxinfu.service.ShenxinfuHandleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: LiuJiaji
 * @date: 2025/10/14 10:09
 * @description: TODO 业务处理类
 * @param:
 * @return:
 **/
@EnableScheduling
@RestController("shenxinfuHandleController")
@RequestMapping("/api/shenxinfuHandleController")
public class ShenxinfuHandleController {

    @Autowired
    private ShenxinfuHandleService shenxinfuHandleService;

    /**
     * @author: LiuJiaji
     * @date: 2025/10/14 10:12
     * @description: TODO 推送组织和人员信息到深信服 注意调用顺序
     * @param:
     * @return:
     **/
    @PostMapping("/pushgrouperinfotosxf")
    public void pushbsinfotosxf(){
        //同步组织信息
        shenxinfuHandleService.createLocalGroup();
        //同步人员信息
        shenxinfuHandleService.createLocalPerson();
        //修改人员信息
        shenxinfuHandleService.updateLocalPerson();
        //修改部门信息  先调用部门修改,再调用删除
        shenxinfuHandleService.updateLocalGroup();
    }

    /**
     * @author: LiuJiaji
     * @date: 2025/10/14 10:12
     * @description: TODO 推送组织和人员信息到深信服 注意调用顺序 定时任务推送
     * @param:
     * @return:
     **/
    @Scheduled(cron="0 30 23 * * ?")
    public void pushbsinfotosxfds(){
        //同步组织信息
        shenxinfuHandleService.createLocalGroup();
        //同步人员信息
        shenxinfuHandleService.createLocalPerson();
        //修改人员信息
        shenxinfuHandleService.updateLocalPerson();
        //修改部门信息  先调用部门修改,再调用删除
        shenxinfuHandleService.updateLocalGroup();
    }


}
